package com.itheima.one;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Scanner;

//单个客户端
public class Client {
    public static void main(String[] args) throws IOException {
        //获取本机ip
        InetAddress addr = InetAddress.getLocalHost();
        Socket socket=new Socket(addr.getHostAddress(),9999);
        OutputStream os=socket.getOutputStream();
        PrintStream ps=new PrintStream(os);
        Scanner sc=new Scanner(System.in);
        while(true){
            System.out.print("请说：");
            String msg=sc.nextLine();
            ps.println(msg);
            ps.flush();
        }
    }
}
